package com.gitee.fanx.retty.spring.controller;

import java.util.Collections;
import java.util.Map;

import org.springframework.web.bind.annotation.*;

import com.gitee.fanx.retty.spring.User;

@RestController
@RequestMapping("book")
public class BookController {

	@RequestMapping("/a")
	public User listUser() {
		// 查询用户
		User user = new User();
		user.setId(1);
		user.setName("Leo");
		user.setAge((short) 18);
		return user;
	}

	@GetMapping("/a/duang")
	public User getUserById(@RequestParam("id") Integer id, @RequestParam("name") String name, @RequestHeader("haha") String haha) {
		// 查询用户
		User user = new User();
		user.setId(id);
		user.setName(name);
		user.setAge((short) 18);
		System.out.println(haha);
		return user;
	}

	@DeleteMapping
	public Map<String, String> doHandle() {
		return Collections.singletonMap("title", "野蛮生长");
	}

}
